import java.util.*;
public class ErrorRecovery {
  public static void main(String[ ] args){
        int num = 0;
        boolean  inputMismatch;
        Scanner scanner = new Scanner(System.in);

         do{
              System.out.printf("Enter an integer number  in the [10,100] interval: ");
              try{
                  num = scanner.nextInt( );
                  inputMismatch = false;   // statements up to end of try-block are not executed  if there is an exception
     	          if(num < 10 || num >100) //
                     System.out.println("Sorry input outside the range [10, 100], try again."); //
               }
               catch(InputMismatchException e){
                   System.out.printf("Error: " + e + ", try again.%n");
                   inputMismatch = true;
                   scanner.nextLine();      // clear the input buffer otherwise the loop becomes infinite
               }
        }while (inputMismatch || num < 10 || num > 100);

        System.out.printf("Now your input of %d is correct.", num);
  }
}
